The present invention relates to a duplex disk controller in a computer system.
If important data are lost by the failure of the hard disk in the computer system, such loss of data has a fatal influence upon the overall system. Therefore, normally a system for duplicating the hard disk and writing the same data in dual disks is employed.
Accordingly, if one hard disk is out of order, the system operation can be continued based on data contents written on the other hard disk.
In this case, if data stored in both hard disks do not coincide with each other or if one of the hard disks is exchanged because of the failure, etc., the hard disk that stores the latest data (master disk) must be automatically decided in starting the computer system, and then the data stored in both hard disks must be made equal by copying data contents in the master disk into the other hard disk (slave disk).
Thus, as a means for automatically deciding the master disk, the duplex disk controller is disclosed in Japanese Patent No.2665199.
According to such duplex disk controller, it is intended to compensate the consistency between data contents in the dual hard disk by using partner disk error information, time stamp, and own device number.
Then, a duplex disk controller in the conventional art will be explained hereunder. FIG. 7 is a flowchart showing processing operations in a master disk deciding process in the duplex disk controller in the conventional art. In this case, one hard disk denotes a disk #0 and the other hard disk denotes a disk #1.
In starting the computer system shown in FIG. 7, an accessible disk is detected based on open requests issued to both disks (disk #0 and disk #1) respectively and partner disk error information stored in both disks respectively (step S71).
If only the disk #0 is accessible, a disk state of the disk #0 is set to ON and then one-side operation using the disk #0 is performed (step S72).
If only the disk #1 is accessible, a disk state of the disk #1 is set to ON and then one-side operation using the disk #1 is performed (step S73).
If both disks are accessible, time stamps stored in the disk #0 and the disk #1 respectively are compared with each other (step S74). Where the time stamp corresponds to time information concerning data update time.
If the time stamp of the disk #0 is new, the data in the disk #1 is recovered based on the disk #0. In other words, the disk state of the disk #0 is set to ON, and the disk state of the disk #1 is set to the recovery (step S75) Then, the recovery of the disk #1 is performed (step S76). After the recovery is finished, the disk state of the disk #1 is changed from the recovery to ON (step S77). Then, the mirroring operation is started.
In step S74, it is decided that the time stamp of the disk #1 is new, data of the disk #0 are recovered based on the disk #1. In other words, the disk state of the disk #1 is set to ON, and the disk state of the disk #0 is set to the recovery (step S78). Then, the recovery of the disk #0 is performed (step S79). After the recovery is finished, the disk state of the disk #0 is changed from the recovery to ON (step S80). Then, the mirroring operation is started.
In step S74, it is decided that the time stamps of both disks are the same time, the disk states are checked (step S81) If the disk states stored in both disks are OFF, such disk states of both disks are set to ON (step S82). Then, the mirroring operation is started.
In step S81, only the disk state of the disk #0 is OFF, data of the disk #1 are recovered based on the disk #0 (step S75 to step S77). Then, the mirroring operation is started.
In step S81, only the disk state of the disk #1 is OFF, data of the disk #0 are recovered based on the disk #1 (step S78 to step 580). Then, the mirroring operation is started.
In step S81, it is decided that the disk states of both disks are ON, own device numbers stored in both disks are compared with each other (step S83).
If own device number of the disk #0 is small, the data of the disk #1 are recovered based on the disk #0 (step S75 to step S77). Then, the mirroring operation is started. If own device number of the disk #1 is small, the data of the disk #0 are recovered based on the disk #1 (step S78 to step S80). Then, the mirroring operation is started.
As described above, according to the above duplex disk controller in the conventional art, the master disk is decided by using partner disk error information, time stamp, and own device number, and then the data contents in both disks are made to coincide with each other by copying the data from the master disk to the slave disk.
However, according to the above duplex disk controller in the conventional art, if one of or both hard disks (the first hard disk and the second hard disk) are exchanged because of the failure of the hard disk or the version up of the software, in some cases it cannot be decided precisely which disk system among the first disk device and the second disk device corresponds to the master disk.
In other words, in the case of the duplex disk controller in the conventional art, the process is performed under the assumption that the latest data are surely stored in the disk having smaller own device number. However, in case the latest data are stored in the disk having larger own device number, the disk in which old data are stored is decided as the master disk and thus the latest data are erased.
Also, the process performed when own device numbers of both disks coincide with each other and the process performed when the hard disk of the different system is installed are not disclosed at all.
It is an object of the present invention to provide a duplex disk controller capable of deciding precisely a master disk and compensating consistency of data contents between disk devices even if a hard disk is exchanged.
In order to attain the above object, a duplex disk controller of the present invention comprises a first disk device and a second disk device; and a disk device controller for storing data into both the first disk device and the second disk device to duplicate the data; wherein the disk device controller uses a device number assigned previously to CPU as reference device information, holds the device number in both the first disk device and the second disk device, collates device numbers held in the first disk device and the second disk device respectively with the reference device information, and decides which one of the first disk device and the second disk device corresponds to a master disk, based on a collated result.
According to the above configuration, even if the hard disk is exchanged, the master disk can be identified by the simple procedures, and in turn the consistency of the data contents between the first disk device and the second disk device can be compensated.
Also, a duplex disk controller of the present invention comprises a first disk device for holding first device information, a second disk device for holding second device information, a disk device controller for reading/writing data from/to the first disk device and the second disk device and reading/writing management information including data writing update time and a status flag which is different before and after data writing update, a reference device information holder for holding peculiar reference device information previously, and a master disk decider for collating the first device information held in the first disk device and the second device information held in the second disk device with reference device information held in the reference device information holder, and then deciding which one of the first disk device and the second disk device corresponds to a master disk, based on collated results and contents of the management information.
According to the above configuration, the disk device controller can identify precisely which one of the first disk device and the second disk device corresponds to the master disk by employing the management information such as the data update times and a flag status that is different before and after the data update in addition to the reference device information as decision factors.
Also, in the duplex disk controller of the present invention, the reference device information, the first device information, and the second device information contain a MAC (Media Access Control) address.
According to the above configuration, since the MAC address is assigned to the first disk device and the second disk device as the reference device information respectively, the master disk can be identified precisely based on the MAC address peculiar to the device.
Also, in the duplex disk controller of the present invention, the reference device information, the first device information, and the second device information contain MAC addresses and partition information.
According to the above configuration, the type of the first disk device and the second disk device can be specified, and then it can be identified more precisely by adding the decision of the MAC address which one of the first disk device and the second disk device corresponds to the master disk.